﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Script.Services;
using System.Web.Services;
using Backend.BLL;
using Backend.DTO;

namespace ReSeSSApplication.WebService
{
    /// <summary>
    /// Summary description for GenericListsWebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]

    [ScriptService]
    public class GenericListsWebService : System.Web.Services.WebService
    {
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World !!!";
        }

        [WebMethod]
        public List<GenericListDTO> GetSearchResultOfGenericLists(int type, string keyword)
        {
            try
            {
                ListBLL aListBll = new ListBLL();
                List<GenericListDTO> listOfGenericLists = aListBll.GetGenericLists(type, keyword, 20);

                return listOfGenericLists;
            }
            catch (Exception)
            {
                return null;
            }
        }

        [WebMethod]
        public List<PharmaceuticalsListsDTO> GetSearchResultOfPharmaceuticalsLists(string keyword)
        {
            try
            {
                ListBLL aListBll = new ListBLL();
                List<PharmaceuticalsListsDTO> listOfPharmaceuticalsLists = aListBll.GetPharmaceuticalLists(keyword, 20);

                return listOfPharmaceuticalsLists;
            }
            catch (Exception)
            {
                return null;
            }
        }
    }
}
